<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('机构手推')" />
    <th:block th:include="include :: daterangepicker-css" />
    <th:block th:include="include :: select2-css" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">

            <div class="col-sm-12 search-collapse">
                <div class="col-sm-4 ">
                    <div class="ibox">
                        <div class="ibox-title">
                            <h5>机构信息</h5>
                        </div>
                        <div class="ibox-content">
                            <input type="hidden" id="infoId" th:value="${specialCostomInfo.id}">
                            <table class="table table-hover margin top left right" style="table-layout:fixed;">
                                <tbody>
                                <tr>
                                    <td >机构名称</td>
                                    <td ><span th:text="${specialCostomInfo.name}"></span></td>
                                    <td >类型</td>
                                    <td ><span th:text="${specialCostomInfo.infoType}" ></span></td>
                                </tr>
                                <tr>
                                    <td >余额</td>
                                    <td ><span class="red" th:text="${specialCostomInfo.remainAmount}"></span></td>
                                    <td >状态</td>
                                    <td ><span class="red"  th:text="${specialCostomInfo.status == 1?'开启':'关闭'}"></span></td>
                                </tr>
                                <tr th:if="${specialCostomInfo.infoType == 'CRM'}">
                                    <td >在线人数</td>
                                    <td ><span class="red" th:text="${onlineNumber}"></span></td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                <div class="col-sm-8 ">
                    <div class="ibox">
                        <div class="ibox-title">
                            <h5>任务信息(在线)</h5>
                        </div>
                        <div class="ibox-content">
                            <table class="table table-hover margin top left right" style="table-layout:fixed;">
                                <tbody>
                                <tr th:each="item:${costomItemInfoList}">
                                    <td ><span th:text="${item.descInfo}"></span></td>
                                    <td ><span th:text="${item.priceAmount}"></span></td>
                                    <td ><span th:text="${item.starttime}" ></span></td>
                                    <td ><span th:text="${item.endtime}" ></span></td>
                                </tr>
                                </tbody>
                            </table>

                        </div>
                    </div>
                </div>
            </div>

            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>用户ID：</label>
                                <input type="text" name="uid"/>
                            </li>
                            <li>
                                <label>城市：</label>
                                <input type="text" name="searchInput"/>
                            </li>
                            <li>
                                <label>贷款金额：</label>
                                <select name="loanAmount" class="form-control">
                                    <option value="">所有</option>
                                    <option  th:each="item:${loanAmount.itemList}" th:text="${item.name}" th:value="${item.value}"></option>
                                </select>
                            </li>
                            <li>
                                <label>芝麻信用：</label>
                                <select name="zhimaScore" class="form-control">
                                    <option value="">所有</option>
                                    <option  th:each="item:${zhimaScore.itemList}" th:text="${item.name}" th:value="${item.value}"></option>
                                </select>
                            </li>
                            <li>
                                <label>花呗：</label>
                                <select name="huaBei" class="form-control">
                                    <option value="">所有</option>
                                    <option  th:each="item:${huaBei.itemList}" th:text="${item.name}" th:value="${item.value}"></option>
                                </select>
                            </li>
                            <li>
                                <label>白条：</label>
                                <select name="baiTiao" class="form-control">
                                    <option value="">所有</option>
                                    <option  th:each="item:${baiTiao.itemList}" th:text="${item.name}" th:value="${item.value}"></option>
                                </select>
                            </li>
                            <li>
                                <label>公积金：</label>
                                <select name="gjj" class="form-control">
                                    <option value="">所有</option>
                                    <option  th:each="item:${gjj.itemList}" th:text="${item.name}" th:value="${item.value}"></option>
                                </select>
                            </li>

                            <li>
                                <label>房产：</label>
                                <select name="house" class="form-control">
                                    <option value="">所有</option>
                                    <option  th:each="item:${house.itemList}" th:text="${item.name}" th:value="${item.value}"></option>
                                </select>
                            </li>

                            <li>
                                <label>车辆：</label>
                                <select name="car" class="form-control">
                                    <option value="">所有</option>
                                    <option  th:each="item:${car.itemList}" th:text="${item.name}" th:value="${item.value}"></option>
                                </select>
                            </li>
                            <li>
                                <label>保单：</label>
                                <select name="insurance" class="form-control">
                                    <option value="">所有</option>
                                    <option  th:each="item:${insurance.itemList}" th:text="${item.name}" th:value="${item.value}"></option>
                                </select>
                            </li>
                            <li>
                                <label>社保：</label>
                                <select name="socialInsurance" class="form-control">
                                    <option value="">所有</option>
                                    <option  th:each="item:${socialInsurance.itemList}" th:text="${item.name}" th:value="${item.value}"></option>
                                </select>
                            </li>
                            <li>
                                <label>注册时间：</label>
                                <input type="text" width="150px" id="createTime" name="createTime" autocomplete="off"/>
                            </li>

                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
     <th:block th:include="include :: daterangepicker-js" />
     <th:block th:include="include :: select2-js" />
    <script th:inline="javascript">
        var prefix = ctx + "member/extInfo";

        $(function() {
            var options = {
                url: prefix + "/list",
                modalName: "用户信息",
                columns: [
                    {
                        field: 'uid',
                        title: 'uid',
                        formatter: function (value,row,index){
                            var result = '<span style="color: #1c84c6; border-bottom: 1px solid" onclick="memberInfoView(\''+row.uid+'\')">'+row.uid+'</a>';
                            return result;
                        }
                    },
                    {
                        field: 'mobileStr',
                        title: '手机号'
                    },
                    {
                        field: 'username',
                        title: '姓名',
                        formatter: function (value,row,index){
                            return row.usernameStr + "-" + row.age + '-' +(row.sex == 1?"男":"女");
                        }
                    },
                    {
                        field: 'province',
                        title: '省',
                        formatter: function (value,row,index){
                            return row.province+'-'+row.city;
                        }
                    },
                    {
                        field: 'yuqi',
                        title: '是否逾期'
                    },
                    {
                        field: 'loanAmount',
                        title: '贷款金额'
                    },
                    {
                        field: 'zhimaScore',
                        title: '芝麻信用'
                    },
                    {
                        field: 'baitiao',
                        title: '白条'
                    },
                    {
                        field: 'huabei',
                        title: '花呗'
                    },
                    {
                        field: 'gjj',
                        title: '公积金'
                    },
                    {
                        field: 'house',
                        title: '房产信息'
                    },
                    {
                        field: 'car',
                        title: '车辆信息'
                    },
                    {
                        field: 'insurance',
                        title: '保单'
                    },
                    {
                        field: 'socialInsurance',
                        title: '社保'
                    },
                    {
                        field: 'createTime',
                        title: '创建时间'
                    },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="toPuahInfo(\'' + row.uid + '\')"><i class="fa fa-edit"></i>推送</a> ');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });

        $('#createTime').daterangepicker({
                "timePicker": true,
                "timePicker24Hour": true,
                "timePickerSeconds": true,
                "locale": {
                    "direction": "ltr",
                    "format": "YYYY-MM-DD HH:mm:ss",
                    "separator": " ~ ",
                    "applyLabel": "确定",
                    "cancelLabel": "取消",
                    "daysOfWeek": [ "七", "一", "二", "三", "四", "五", "六"],
                    "monthNames": ["1","2","3","4","5","6","7","8","9","10","11","12"
                    ],
                    // "firstDay": 1
                }
            },function (){}
        );

        /* 用户管理启用 */
        function toPuahInfo(uid) {
            $.modal.confirm("确认推送【"+uid+"】用户信息？", function() {
                $.ajax({
                    type: "post",
                    url: ctx + "special/info/manualPushAction",
                    data: {
                        "infoId": $("#infoId").val(),
                        "uid": uid
                    },
                    success: function(result) {
                        if (result.code == 0){
                            $.modal.msgSuccess("推送成功")
                        }else{
                            $.modal.msgError(result.msg)
                        }
                    }
                });
            })
        }

        function memberInfoView(uid){
            var url = ctx + "member/info/view/" + uid;
            $.modal.open('用户详情', url);
        }

    </script>
</body>
</html>